package fr.mywiki.view.web.struts.form.version;

import java.rmi.RemoteException;

import org.apache.struts.action.ActionForm;

import fr.mywiki.business.versioning.VersionLite;
import fr.mywiki.model.ejbAdapter.DataController;

/** Form dealing with the versions comparison */
public class CompareVersionsForm extends ActionForm {
	private static final long serialVersionUID = 1L;
	
	private VersionLite fromLite;
	private VersionLite toLite;
	
	private String fromText;
	private String toText;
	
	/**
	 * Initializes the formular.
	 * 
	 * @param fromId Identifier of the from version
	 * @param toId Identifier of the to version
	 */
	public void init(Long fromId, Long toId) throws RemoteException {
		fromLite = (VersionLite) DataController.getValue(fromId,VersionLite.TYPE_ENT);
		toLite = (VersionLite) DataController.getValue(toId,VersionLite.TYPE_ENT);
		
		fromText = fromLite.getContent();
		toText = toLite.getContent();
	}
	
	public VersionLite getFromLite() {
		return fromLite;
	}
	public void setFromLite(VersionLite fromLite) {
		this.fromLite = fromLite;
	}
	public VersionLite getTo() {
		return toLite;
	}
	public void setToLite(VersionLite toLite) {
		this.toLite = toLite;
	}

	public String getFromText() {
		return fromText;
	}

	public void setFromText(String fromText) {
		this.fromText = fromText;
	}

	public String getToText() {
		return toText;
	}

	public void setToText(String toText) {
		this.toText = toText;
	}
}
